package com.hnnu.shoppingtoghter.demo.service.impl;

import com.github.pagehelper.PageHelper;
import com.hnnu.shoppingtoghter.demo.entity.SysUser;
import com.hnnu.shoppingtoghter.demo.mapper.SysUserMapper;
import com.hnnu.shoppingtoghter.demo.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysUserServiceImpl implements SysUserService {

    @Autowired
    private SysUserMapper sysUserMapper;


    /**
     * pdy
     * 根据用户账号密码从数据库中查询对应用户数据
     * @param userCode
     * @param userPassword
     * @return
     */
    @Override
    public SysUser selectUserByUserCodeUserPassword(String userCode, String userPassword) {
        return sysUserMapper.selectUser(userCode, userPassword);
    }
    /**
     * pdy
     * 将SysUser 对象插入到数据库中
     */
    @Override
    public int insertUser(SysUser user){
        user.setDelFlag(0);
        return sysUserMapper.insertUser(user);
    }

    /**
     * @Description: TODO
     * @Author: Liu_aihuan
     * @CreateTime: 2022/7/6 2:02
     * @param: null
     * @return: null
     **/
    @Override
    public int updateUser(SysUser user) {
        return sysUserMapper.updateUser(user);
    }

    /**
     * @Description: TODO
     * @Author: Liu_aihuan
     * @CreateTime: 2022/7/6 2:56
     * @param: null
     * @return: null
     **/
    @Override
    public int updateUserPassword(SysUser user) {
        return sysUserMapper.updateUserPassword(user);
    }
    @Override
    public int updateHeadImages(long id, String s) {
        return sysUserMapper.updateHeadImages(id, s);
    }
}
